package com.songshuai.webapi.crm.dto.request.customer;

import com.songshuai.webapi.baseapi.utils.DateUtil;
import com.songshuai.webapi.crm.util.Util;
import lombok.Data;

import java.util.Date;

@Data
public class CustomerListReqDto {

    //学员姓名/手机号
    private String customerParam;
    //跟进人
    private Integer owner;
    //跟进状态
    private Integer followStatus;
    //下次跟进时间（开始）
    private String nextCommunicateTimeStart;
    public Date getNextCommunicateTimeStart(){
        return Util.ChangeStringToDate(nextCommunicateTimeStart, DateUtil.dateFormat);
    }
    //下次跟进时间（结束）
    private String nextCommunicateTimeEnd;
    public Date getNextCommunicateTimeEnd(){
        Date date = Util.ChangeStringToDate(nextCommunicateTimeEnd, DateUtil.dateFormat);
        if(date != null){
            date = DateUtil.rolAfterDay(date,1);
        }
        return date;
    }
    //创建时间（开始）
    private String createTimeStart;
    public Date getCreateTimeStart(){
        return Util.ChangeStringToDate(createTimeStart, DateUtil.dateFormat);
    }
    //创建时间（结束）
    private String createTimeEnd;
    public Date getCreateTimeEnd(){
        Date date = Util.ChangeStringToDate(createTimeEnd, DateUtil.dateFormat);
        if(date != null){
            date = DateUtil.rolAfterDay(date,1);
        }
        return date;
    }
    //最后沟通时间（开始）
    private String lastCommunicateTimeStart;
    public Date getLastCommunicateTimeStart(){
        return Util.ChangeStringToDate(lastCommunicateTimeStart, DateUtil.dateFormat);
    }
    //最后沟通时间（结束）
    private String lastCommunicateTimeEnd;
    public Date getLastCommunicateTimeEnd(){
        Date date = Util.ChangeStringToDate(lastCommunicateTimeEnd, DateUtil.dateFormat);
        if(date != null){
            date = DateUtil.rolAfterDay(date,1);
        }
        return date;
    }
    //年龄（开始）
    private Integer ageStart;
    //年龄（结束）
    private Integer ageEnd;
    //生日（开始）
    private String birthdayStart;
    public Date getBirthdayStart(){
        if(ageStart != null) {
            Date date = DateUtil.rolBeforeYear(new Date(),ageStart);
            return DateUtil.rolAfterDay(date,1);
        }
        return null;
    }
    //生日（结束）
    private String birthdayEnd;
    public Date getBirthdayEnd(){
        if(ageEnd != null) {
            return DateUtil.rolBeforeYear(new Date(),ageEnd);
        }
        return null;
    }
    private Integer effectSource;
}
